#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <netinet/tcp.h>

#include <exec/execbase.h>
#include <proto/exec.h>
#include "subthreads_amiga.h"

#undef SocketBase
#define SocketBase ((struct thread_s*)(((struct ExecBase*)SysBase)->ThisTask)->tc_UserData)->socketlib

#include "socket-morphos.h"

int _mos_shutdown(int sock, int how)
{
	return shutdown(sock, how);
}

int _mos_select(int p1, fd_set * p2, fd_set * p3, fd_set * p4, struct timeval * p5)
{
	return WaitSelect(p1, p2, p3, p4, p5, NULL);
}

int _mos_connect(int sock, const struct sockaddr * addr, ULONG len)
{
	return connect(sock, addr, len);
}

int _mos_socket(int p1, int p2, int p3)
{
	return socket(p1, p2, p3);
}

int _mos_send(int fd, void * buf, size_t n, int flags)
{
	return send(fd, buf, n, flags);
}

int _mos_recv(int fd, void * buf, size_t n, int flags)
{
	return recv(fd, buf, n, flags);
}

